package JVM;

import sun.management.MethodInfo;

import java.lang.reflect.Type;
import java.util.Queue;
import java.util.Stack;

/**
 * @author: 谢君臣
 * @create: 2020-09-19 9:58
 * @founction: XXXX
 */
class user{
    void run(){
        System.out.println("I can run.");
    }
}
public class TestStack {
    public static final int MAXIMUM_CAPACITY = 1024;
    public static void main(String[] args) {
//        Stack<String> stack = new Stack<>();
//        stack.push("sdfsadf");
//        stack.push("sdfsadf");
//        stack.push("sdfsadf");
//        stack.push("sdfsadf");
//        System.out.println(stack.size());
//        System.out.println(stack.peek());

        int i = tableSizeFor(10);
        System.out.println(i);

    }
    static final int tableSizeFor(int cap) {
        int n = cap - 1;
        n |= n >>> 1;
        n |= n >>> 2;
        n |= n >>> 4;
        n |= n >>> 8;
        n |= n >>> 16;
        return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
    }
    static void test(){
    }
;}

